package com.jic.order.impl;

import java.lang.Long;
import java.util.List;


import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.order.entity.OrderAutomaticAftersale;
import com.jic.order.mapper.OrderAutomaticAftersaleMapper;
import com.jic.order.service.OrderAutomaticAftersaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 售后单自动审核表
 * @author : 
 * @email : 
 * @since : 2020-03-02 01:20:15
 * @version : v1.0.0
 */
@Service
public class OrderAutomaticAftersaleServiceImpl implements OrderAutomaticAftersaleService {

    @Autowired
    private OrderAutomaticAftersaleMapper orderAutomaticAftersaleMapper;

    @Override
    public long insert(OrderAutomaticAftersale orderAutomaticAftersale) {
        long flag = orderAutomaticAftersaleMapper.insert(orderAutomaticAftersale);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return orderAutomaticAftersaleMapper.delete(id);
    }

    @Override
    public long update(OrderAutomaticAftersale orderAutomaticAftersale) {
        return orderAutomaticAftersaleMapper.update(orderAutomaticAftersale);
    }

    @Override
    public OrderAutomaticAftersale queryByPrimaryKey(Long id){
        return orderAutomaticAftersaleMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<OrderAutomaticAftersale> query(OrderAutomaticAftersale orderAutomaticAftersale){
        return orderAutomaticAftersaleMapper.query(orderAutomaticAftersale);
    }

    @Override
    public PageResult<OrderAutomaticAftersale> queryPage(OrderAutomaticAftersale orderAutomaticAftersale, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<OrderAutomaticAftersale> list = orderAutomaticAftersaleMapper.queryPage(startIndex, pageQuery.getLimit(), orderAutomaticAftersale);
        long count = orderAutomaticAftersaleMapper.queryPageCount(orderAutomaticAftersale);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}